<?php
    Atomik::needed("propel");
    $querie = TabAdminQuery::create()->filterByLogin($_SESSION["admin_login"])->findOne();
    if($querie->getFkDroit()!=2||!isset($_GET["date"])){
        Atomik::redirect("?");
    }
    $tmp_date = explode("/", $_GET["date"]);
    $date = new DateTime();
    $date->setDate($tmp_date[2], $tmp_date[1]+1, $tmp_date[0]);
    Atomik::needed("propel");
    $repartitions = TabRepartitionQuery::create()->filterByFkAdmin($querie->getIdAdmin())->orderByDateRepartition(Criteria::ASC)->where(TabRepartitionPeer::DATE_REPARTITION." like '".$date->format("Y-m-d")." %:%:%'")->limit(10)->find();
    //echo $repartitions->count();
    if($repartitions->count()==0){
        Atomik::redirect("?");
    }
    $depart = $repartitions->getFirst()->getTabStation();
    $arrive = $repartitions->getLast()->getTabStation();
?>
